<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="apliPath" value="${pageContext.request.contextPath}/"
	scope="application" />
<%@ page pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cold Water</title>
<link href="${apliPath}static/css/default.css" rel="stylesheet"
	type="text/css" />
<link rel="stylesheet" type="text/css"
	href="${apliPath}static/js/themes/metro-solidBlue/easyui.css" />
<link rel="stylesheet" type="text/css"
	href="${apliPath}static/js/themes/icon.css" />
<link rel="shortcut icon" type="image/x-icon"
	href="${apliPath}static/images/rihanna.ico" media="screen" />
<link rel="icon" href="${apliPath}static/images/rihanna.ico"
	type="image/x-icon" />
<link rel="bookmark" href="${apliPath}static/images/rihanna.ico"
	type="image/x-icon" />
<script type="text/javascript"
	src="${apliPath}static/js/jquery-1.10.2.js"></script>
<script type="text/javascript"
	src="${apliPath}static/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${apliPath}static/js/md5.js"></script>
<script type="text/javascript"
	src="${apliPath}static/js/cryptoJS/core-min.js"></script>
<script type="text/javascript"
	src="${apliPath}static/js/cryptoJS/aes.js"></script>
<script type="text/javascript"
	src="${apliPath}static/js/cryptoJS/mode-ecb.js"></script>
<script type="text/javascript"
	src="${apliPath}static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(function() {
		getTime();
		window.setInterval(getTime, 1000);
		//设置回车键出发登录事件
		document.onkeydown = function(event) {
			var e = event || window.event
					|| arguments.callee.caller.arguments[0];
			if (e && e.keyCode == 13) {
				login();
			}
		};
	});
	function login() {
	    $('#loginImage').attr('src','${aplipath}static/images/wait.gif');
		var transData = new Object();
		transData.code = document.getElementById("userName").value,
				transData.password = Encrypt(document
						.getElementById("password").value, "proudToLoveAdios"),
				$.post("${apliPath}manager/query", transData, function(data) {
					if (data == true) {
						window.location.href = "${apliPath}index.html";
					} else {
					$('#loginImage').attr('src','${aplipath}static/images/loginButton.png');
						alert("FUCK OFF !!!");
					}
				});
	}
	function getTime() {
		var date = new Date();
		var y = date.getFullYear();
		var m = date.getMonth() + 1;
		var d = date.getDate();
		var h = date.getHours();
		var i = date.getMinutes();
		var s = date.getSeconds();
		$("#sysTime").html(
				y + "年" + (m > 9 ? m : ("0" + m)) + "月"
						+ (d > 9 ? d : ("0" + d)) + "日 "
						+ (h > 9 ? h : ("0" + h)) + ":"
						+ (i > 9 ? i : ("0" + i)) + ":"
						+ (s > 9 ? s : ("0" + s)));
	}
	function Encrypt(word, key) {
		var secreKey = CryptoJS.enc.Utf8.parse(key);
		var srcs = CryptoJS.enc.Utf8.parse(word);
		var encrypted = CryptoJS.AES.encrypt(srcs, secreKey, {
			mode : CryptoJS.mode.ECB,
			padding : CryptoJS.pad.Pkcs7
		});
		return encrypted.toString();
	}
	function Decrypt(word, key) {
		var secreKey = CryptoJS.enc.Utf8.parse(key);
		var decrypt = CryptoJS.AES.decrypt(word, secreKey, {
			mode : CryptoJS.mode.ECB,
			padding : CryptoJS.pad.Pkcs7
		});
		return CryptoJS.enc.Utf8.stringify(decrypt).toString();
	}
</script>
</head>
<body>
	<form id="loginForm">
		<table border="0" width="100%" height="100%" align="center"
			style="margin-top:12%;">
			<tr>
				<td width="30%"></td>
				<td width="140" colspan="2"><img
					src="${apliPath}static/images/Curry.png" height="140" width="140"
					alt="" /></td>
			</tr>
			<tr>
				<td></td>
				<td width="120"></td>
				<td><table cellpadding="3">
						<tr height="35">
							<td align="right"><img
								src="${apliPath}static/images/man.png" />账号：</td>
							<td><input id="userName" type="text" /></td>
							<td rowspan="2"><img onclick="login()"  id = 'loginImage' width="80" height="80"
								src="${apliPath}static/images/loginButton.png" alt="" /></td>
						</tr>
						<tr height="35">
							<td align="right"><img
								src="${apliPath}static/images/lock.png" />密码：</td>
							<td><input id="password" type="password" /></td>
						</tr>
						<tr height="35">
							<td align="right">验证码：</td>
							<td colspan="2"><input name="identifyingCode" type="text"
								id="identifying" /> <img align="middle" width="114" height="20"
								id="imgVcode" src="${apliPath}manager/identifyingCode" /> <a
								href="javascript:;"
								onclick="document.getElementById('imgVcode').src = '${apliPath}manager/identifyingCode?'+(new Date())">看不清楚？换个图片</a></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
</body>
</html>